home *** CD-ROM | disk | FTP | other *** search
/ Internet Info 1994 March / Internet Info CD-ROM (Walnut Creek) (March 1994).iso / networking / ip / ka9q / osrc.arc / UDP.H < prev    next >
Encoding:
C/C++ Source or Header  |  1989-05-28  |  1.6 KB  |  59 lines

  1. #ifndef    NUDP
  2.  
  3. #include "global.h"
  4. #include "netuser.h"
  5.  
  6. /* User Datagram Protocol definitions */
  7.  
  8. #define    NUDP    20
  9.  
  10. /* Structure of a UDP protocol header */
  11. struct udp {
  12.     int16 source;    /* Source port */
  13.     int16 dest;    /* Destination port */
  14.     int16 length;    /* Length of header and data */
  15.     int16 checksum;    /* Checksum over pseudo-header, header and data */
  16. };
  17. #define    UDPHDR    8    /* Length of UDP header */
  18.  
  19. /* User Datagram Protocol control block
  20.  * Each entry on the receive queue consists of the
  21.  * remote socket structure, followed by any data
  22.  */
  23. struct udp_cb {
  24.     struct udp_cb *prev;    /* Linked list pointers */
  25.     struct udp_cb *next;
  26.     struct socket socket;    /* Local port accepting datagrams */
  27.     void (*r_upcall)();    /* Function to call when one arrives */
  28.     struct mbuf *rcvq;    /* Queue of pending datagrams */
  29.     int rcvcnt;        /* Count of pending datagrams */
  30.     int user;        /* User link */
  31. };
  32. extern struct udp_cb *Udps[];    /* Hash table for UDP structures */
  33. #define    NULLUDP    (struct udp_cb *)0
  34.  
  35. /* UDP statistics counters */
  36. struct udp_stat {
  37.     int16 rcvd;        /* Packets received */
  38.     int16 sent;        /* Packets sent */
  39.     int16 cksum;        /* Checksum errors */
  40.     int16 unknown;        /* Unknown socket */
  41.     int16 bdcsts;        /* Incoming broadcasts */
  42. };
  43.  
  44. /* UDP primitives */
  45. #if    defined(__STDC__) || defined(__TURBOC__)
  46. int recv_udp(struct udp_cb *up,struct socket *fsocket,struct mbuf **bp);
  47. int send_udp();
  48. int del_udp(struct udp_cb *up);
  49. void udp_dump(struct mbuf **bpp,int32 source,int32 dest,int check);
  50. struct udp_cb *open_udp();
  51. #else
  52. int recv_udp(),send_udp(),del_udp();
  53. void udp_dump();
  54. struct udp_cb *open_udp();
  55. #endif
  56.  
  57. #endif    /* NUDP */
  58.  
  59.